<div class="album wp-20 channel-manage" ui-view="container">
    <div ng-if="!noPermission">
        <div class="head_title">
            <span class="tit-color">二级频道</span>
        </div>

        <div class="panel specific-search">
            <div class="searchWapper">
                <div class="form-group searchLump">
                    <div class="searchTitle">筛选：</div>
                    <div class="search-select">
                        <select  ng-model="search.categoryId" style="margin-left: 6px"
                                 ng-init="search.categoryId?search.categoryId:categoriesList[0].id"
                                 ng-change="channelChange(search.categoryId)">
                            <option value="{{item.categoryId}}" ng-repeat="item in categoriesList">{{item.categoryName}}</option>
                        </select>
                    </div>
                </div>
                <div class="form-group searchLump">
                    <div class="searchTitle">操作：</div>
                    <button type="button" class="btn-primary btn btn-select" ng-click="create()">
                        新建
                    </button>
                    <button type="button" class="btn-primary btn btn-select" ng-click="enableAll()">
                        启用
                    </button>
                    <button type="button" class="btn-primary btn btn-select" ng-click="disableAll()">
                        禁用
                    </button>
                    <!--<button type="button" class="btn-primary btn btn-select" ng-click="delete()">-->
                        <!--删除-->
                    <!--</button>-->
                </div>
            </div>
        </div>

        <div class="table-responsive">
            <table class="table table-bordered table-hover table-page">
                <thead>
                <tr>
                    <th>
                        <input type="checkbox" id="allCheck" ng-checked="" class="magic-checkbox" ng-model="checkData.allChecked"
                                ng-change="selectAllChange(checkData.allChecked)">
                        <label for="allCheck" ></label>
                    </th>
                    <th>频道_ID</th>
                    <th>频道名称</th>
                    <th>一级频道</th>
                    <th>专辑数</th>
                    <th>节目数</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="item in channelsList">
                    <td>
                        <input type="checkbox" id="{{$index}}" class="magic-checkbox" ng-model="item.checked"
                               ng-change="selectOneChange(item.checked)">
                        <label for="{{$index}}" ></label>
                    </td>
                    <td>{{item.channelId}}</td>
                    <td>{{item.channelName}}</td>
                    <td>{{item.categoryName}}</td>
                    <td>{{item.albumNum}}</td>
                    <td>{{item.programNum}}</td>
                    <td>{{table[item.status]}}</td>
                    <td>
                        <a href="javascript:void(0);" ng-click="edit(item)" class="time-out">
                            编辑
                        </a>
                        <a ng-if="item.status==4" ng-click="disable(item)" class="time-out">禁用</a>
                        <a ng-if="item.status==2" ng-click="enable(item)" class="time-out">启用</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="panel-footer paging">
            <s-pagination conf="paginationConf"></s-pagination>
        </div>
    </div>
    <div ng-if="noPermission" ng-include="'templates/no-permission.html'">
</div>

<script type="text/ng-template" id="twoLevelModel.html">
    <div class="modal-header ng-scope">
        <button type="button" class="close" ng-click="cancel()"><span>×</span></button>
        <span class="modal-title ng-binding">频道管理</span>
    </div>
    <form class="w5c-form demo-form"  w5c-form-validate name="twoLevel">
        <div class="modal-body ng-scope popup-menu">
            <div class="control-group text-align-left channel-manage form-group" style="margin-bottom: 8px">
                <label class="control-label form-require w-109"><i class="red-icon">*</i>频道名称：</label>
                <div class="controls modal-input">
                    <input type="text" placeholder="频道名称" ng-model="formData.channelName"
                            name="LevelName" required  pattern="^[\u4e00-\u9fa5]{2,6}$">
                </div>
            </div>
            <div class="control-group text-align-left form-group">
                <label class="control-label form-require w-109 channel-title" ><i class="red-icon">*</i>上级频道：</label>
                <div class="controls modal-input channel-list">
                    <label class=" iw-110" ng-repeat="item in categoriesList">
                        <input type="radio" name="categoryId" value="{{item.categoryId}}" class="magic-radio" id="{{item.categoryId}}" ng-model="formData.categoryId" required>
                        <label for="{{item.categoryId}}" style="top: -1px;margin: 0px 10px 0px -18px;"></label>
                        {{item.categoryName}}
                    </label>

                </div>
                <input type="hidden" name="category" ng-model="formData.categoryId" required>
            </div>

            <div style="clear: both"></div>

            <div class="control-group text-align-left">
                <label class="control-label form-require w-109">频道状态：</label>
                <div class="controls modal-input">
                    <label class="radio-inline iw-110" ng-repeat="item in initData.status">
                        <input type="radio" name="status" value="{{item}}" class="magic-radio" id="status{{item}}" ng-model="formData.status">
                        <label for="status{{item}}" style="top: -1px;margin: 0 10px 0 -18px;"></label>
                        {{table[item]}}
                    </label>
                </div>
            </div>
        </div>

        <div class="modal-footer ng-scope">
            <button class="btn btn-primary ng-binding" type="button" ng-if="!formData.channelId" w5c-form-submit="okCreate()">确定</button>
            <button class="btn btn-primary ng-binding" type="button" ng-if="formData.channelId" w5c-form-submit="okEdit()">确定</button>
            <button class="btn ims-btn ng-binding" style="" type="button" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
</div>